package AbstractTransactions

import (
	"PaySalary/Model"
	"fmt"
	"log"
)

type AffiliationTransaction interface {
	RecordMembership(e Model.Employee)
	GetAffiliation() Model.Affiliation
}

type ChangeAffiliationTransaction struct {
	AffiliationTransaction
	ChangeEmployeeTransaction
	Model.Affiliation
}

func (c *ChangeAffiliationTransaction) NewChangeAffiliationTransaction(empid int) {
	c.NewChangeEmployeeTransaction(empid)
}

func (c *ChangeAffiliationTransaction)Change(e Model.Employee)  {
	c.RecordMembership(e)

	af := c.GetAffiliation()
	e.SetItsAffiliation(af)
}

func (c *ChangeAffiliationTransaction) CalculateDeductions(pc Model.Paycheck) {
	err := fmt.Errorf("The method or operation is not implemented.")
	log.Println(err.Error())
}